49564bfacac5417b7c9fe85303d6c7147d45e862,account-parent/account-web/src/main/java/demo/account/AccountController.java,AccountController,archiveAccount,#number#,84

Before Change



    @GetMapping(path = "/accounts/{id}/commands/archive")
    public ResponseEntity archiveAccount(@PathVariable Long id) {
        return Optional.ofNullable(accountService.applyCommand(id, AccountCommand.ARCHIVE_ACCOUNT))
                .map(e -> new ResponseEntity<>(e, HttpStatus.OK))
                .orElseThrow(() -> new IllegalArgumentException("The command could not be applied"));
    }

After Change



    @GetMapping(path = "/accounts/{id}/commands/archive")
    public ResponseEntity archiveAccount(@PathVariable Long id) {
        return Optional.ofNullable(getAccountResource(
                accountService.applyCommand(id, AccountCommand.ARCHIVE_ACCOUNT)))
                .map(e -> new ResponseEntity<>(e, HttpStatus.OK))
                .orElseThrow(() -> new IllegalArgumentException("The command could not be applied"));
    }